﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZeroSubsetSumChecker
{
    class Program
    {
        static bool isThereZeroSum(int[] elementsArray)
        {
            List<int> dinamicOptimizationArray = new List<int>();
            for (int index = 0; index < elementsArray.Length; index++)
            {
                dinamicOptimizationArray.Add(elementsArray[index]);
                int size = dinamicOptimizationArray.Count;
                for (int index2 = 0; index2 < size - 1; index2++)
                {
                    dinamicOptimizationArray.Add( elementsArray[index] + dinamicOptimizationArray[index2]);
                    if (dinamicOptimizationArray[size - 1 + index2] == 0)
                    {
                        return true;
                    }
                }
            }
            return false;
        }
        static void Main(string[] args)
        {
            int[] sequenceOfNumbers = new int[5];
            sequenceOfNumbers[0] = 32;
            sequenceOfNumbers[1] = 299;
            sequenceOfNumbers[2] = -3;
            sequenceOfNumbers[3] = -29;
            sequenceOfNumbers[4] = 8;
            Console.WriteLine(isThereZeroSum(sequenceOfNumbers));


        }
    }
}
